HAL RAMECC Typical use cases for migration

This section provides information about the HAL RAMECC Typical use cases for migration.

HAL SRAM ECC in polling mode at monitor level

Note

- In HAL1, HAL_RAMECC_GetFailingAddress(), HAL_RAMECC_GetFailingDataLow(), HAL_RAMECC_GetFailingDataHigh(), and HAL_RAMECC_GetHammingErrorCode() are replaced in HAL2 by HAL_RAMECC_GetInfo(), which consolidates all ECC error information into a single structure.

- In HAL2, HAL_RAMECC_EnableController() starts all monitors simultaneously, while monitor functions can be used for individual RAM handling.

Sequence diagram

HAL1 Sequence Diagrams

HAL2 Sequence Diagrams

@startuml

== Prerequisite: Initialization and configuration ==

group Process
"User Application" -> "RAMECC Driver" : HAL_RAMECC_StartMonitor()
"RAMECC Driver" --> "User Application" : HAL_OK
"User Application" -> "RAMECC Driver" : HAL_RAMECC_GetFailingAddress()\nHAL_RAMECC_GetFailingDataHigh()\nHAL_RAMECC_GetFailingDataLow()\nHAL_RAMECC_GetHammingErrorCode()
"RAMECC Driver" --> "User Application" : HAL_OK
"User Application" -> "RAMECC Driver" : HAL_RAMECC_StopMonitor()
"RAMECC Driver" --> "User Application" : HAL_OK

end

@enduml

@startuml

== Prerequisite: Initialization and configuration ==

group Process
"User Application" -> "RAMECC Driver" : HAL_RAMECC_EnableMonitor()
"RAMECC Driver" --> "User Application" : HAL_OK
"User Application" -> "RAMECC Driver" : HAL_RAMECC_GetInfo()
"RAMECC Driver" --> "User Application" : HAL_OK
"User Application" -> "RAMECC Driver" : HAL_RAMECC_DisableMonitor()
"RAMECC Driver" --> "User Application" : HAL_OK
end

@enduml

Code snippet

HAL1

HAL2

HAL_RAMECC_StartMonitor(&hramecc);

HAL_RAMECC_GetFailingAddress(&hramecc);
HAL_RAMECC_GetFailingDataHigh(&hramecc);
HAL_RAMECC_GetFailingDataLow(&hramecc);
HAL_RAMECC_GetHammingErrorCode(&hramecc);

HAL_RAMECC_StopMonitor(&hramecc);
HAL_RAMECC_EnableMonitor(HAL_RAMECC_AXISRAM1);

HAL_RAMECC_GetInfo(HAL_RAMECC_AXISRAM1, &ramecc_info);




HAL_RAMECC_DisableMonitor(HAL_RAMECC_AXISRAM1);

HAL SRAM ECC in interrupt mode at monitor level

Sequence diagram

HAL1 Sequence Diagrams

HAL2 Sequence Diagrams

@startuml

== Prerequisite: Initialization and configuration ==

group Process
"User Application" -> "RAMECC Driver" : HAL_RAMECC_StartMonitor()
"RAMECC Driver" --> "User Application" : HAL_OK
"User Application" -> "RAMECC Driver" : HAL_RAMECC_EnableNotification ()
"RAMECC Driver" --> "User Application" : HAL_OK
"HW" --> "NVIC" : Interrupt
"NVIC" --> "RAMECC Driver" : HAL_RAMECC_IRQHandler()
"RAMECC Driver" --> "User Application" : User callback
"User Application" -> "RAMECC Driver" : HAL_RAMECC_GetFailingAddress()\nHAL_RAMECC_GetFailingDataHigh()\nHAL_RAMECC_GetFailingDataLow()\nHAL_RAMECC_GetHammingErrorCode()
"RAMECC Driver" --> "User Application" : HAL_OK
"User Application" -> "RAMECC Driver" : HAL_RAMECC_StopMonitor()
"RAMECC Driver" --> "User Application" : HAL_OK
"User Application" -> "RAMECC Driver" : HAL_RAMECC_DisableNotification()
"RAMECC Driver" --> "User Application" : HAL_OK
end

@enduml

@startuml

== Prerequisite: Initialization and configuration ==

group Process
"User Application" -> "RAMECC Driver" : HAL_RAMECC_EnableMonitor_IT()
"RAMECC Driver" --> "User Application" : HAL_OK
"HW" --> "NVIC" : Interrupt
"NVIC" --> "RAMECC Driver" : HAL_RAMECC_IRQHandler()
"RAMECC Driver" --> "User Application" : User callback
"User Application" -> "RAMECC Driver" : HAL_RAMECC_GetInfo()
"RAMECC Driver" --> "User Application" : HAL_OK
"User Application" -> "RAMECC Driver" : HAL_RAMECC_DisableMonitor()
"RAMECC Driver" --> "User Application" : HAL_OK
end

@enduml

Code snippet

HAL1

HAL2

HAL_RAMECC_StartMonitor(&hramecc);
HAL_RAMECC_EnableNotification(&hramecc, notification);

HAL_RAMECC_GetFailingDataLow(&hramecc);
HAL_RAMECC_GetFailingDataHigh(&hramecc);
HAL_RAMECC_GetFailingDataLow(&hramecc);
HAL_RAMECC_GetHammingErrorCode(&hramecc);

HAL_RAMECC_StopMonitor(&hramecc);
HAL_RAMECC_DisableNotification(&hramecc, notification);

void RAMECC_Callback(void)
{
    /* User callback */
}
HAL_RAMECC_EnableMonitor_IT(HAL_RAMECC_AXISRAM1, HAL_RAMECC_MONITOR_IT_SINGLE);


HAL_RAMECC_GetInfo(HAL_RAMECC_AXISRAM1, &ramecc_info);




HAL_RAMECC_DisableMonitor(HAL_RAMECC_AXISRAM1);


void RAMECC_Callback(void)
{
    /* User callback */
}

HAL SRAM ECC in polling mode at controller level

Sequence diagram

HAL1 Sequence Diagrams

HAL2 Sequence Diagrams

@startuml

== Prerequisite: Initialization and configuration ==
group Process
"User Application" -> "RAMECC Driver" : HAL_RAMECC_StartMonitor(&hsramecc1)
"RAMECC Driver" --> "User Application" : HAL_OK
"User Application" -> "RAMECC Driver" : HAL_RAMECC_StartMonitor(&hsramecc2)
"RAMECC Driver" --> "User Application" : HAL_OK

...

"User Application" -> "RAMECC Driver" : HAL_RAMECC_GetFailingAddress(&hsramecc1)
"RAMECC Driver" --> "User Application" : HAL_OK
"User Application" -> "RAMECC Driver" : HAL_RAMECC_GetFailingAddress(&hsramecc2)
"RAMECC Driver" --> "User Application" : HAL_OK

...

"User Application" -> "RAMECC Driver" : HAL_RAMECC_StopMonitor(&hsramecc1)
"RAMECC Driver" --> "User Application" : HAL_OK
"User Application" -> "RAMECC Driver" : HAL_RAMECC_StopMonitor(&hsramecc2)
"RAMECC Driver" --> "User Application" : HAL_OK
...

end

@enduml

@startuml

== Prerequisite: Initialization and configuration ==

group Process
"User Application" -> "RAMECC Driver" : HAL_RAMECC_EnableController()
"RAMECC Driver" --> "User Application" : HAL_OK
"User Application" -> "RAMECC Driver" : HAL_RAMECC_GetInfo()
"RAMECC Driver" --> "User Application" : HAL_OK
"User Application" -> "RAMECC Driver" : HAL_RAMECC_DisableController()
"RAMECC Driver" --> "User Application" : HAL_OK
end

@enduml

Code snippet

HAL1

HAL2

RAMECC_HandleTypeDef hsramecc1;
RAMECC_HandleTypeDef hsramecc2;

HAL_RAMECC_StartMonitor(&hsramecc1);
HAL_RAMECC_StartMonitor(&hsramecc2);

HAL_RAMECC_GetFailingAddress(&hsramecc1);
HAL_RAMECC_GetFailingAddress(&hsramecc2);

HAL_RAMECC_StopMonitor(&hsramecc1);
HAL_RAMECC_StopMonitor(&hsramecc2);
hal_ramecc_controller_t hsramecc;


HAL_RAMECC_EnableController(hsramecc);


HAL_RAMECC_GetInfo(HAL_RAMECC_AXISRAM1, &ramecc_info);


HAL_RAMECC_DisableController(hsramecc);

HAL SRAM ECC in interrupt mode at controller level

Sequence diagram

HAL1 Sequence Diagrams

HAL2 Sequence Diagrams

== Prerequisite: Initialization and configuration ==

@startuml
group Process
"User Application" -> "RAMECC Driver" : HAL_RAMECC_StartMonitor(&hsramecc1)
"RAMECC Driver" --> "User Application" : HAL_OK
"User Application" -> "RAMECC Driver" : HAL_RAMECC_EnableNotification(&hsramecc1)
"RAMECC Driver" --> "User Application" : HAL_OK

...

"User Application" -> "RAMECC Driver" : HAL_RAMECC_StartMonitor(&hsramecc2)
"RAMECC Driver" --> "User Application" : HAL_OK
"User Application" -> "RAMECC Driver" : HAL_RAMECC_EnableNotification(&hsramecc2)
"RAMECC Driver" --> "User Application" : HAL_OK

...

"HW" --> "NVIC" : Interrupt
"NVIC" --> "RAMECC Driver" : HAL_RAMECC_IRQHandler()
"RAMECC Driver" --> "User Application" : User callback
"RAMECC Driver" --> "User Application" : User callback

...

"User Application" -> "RAMECC Driver" : HAL_RAMECC_GetHammingErrorCode(&hsramecc1)
"RAMECC Driver" --> "User Application" : HAL_OK
"User Application" -> "RAMECC Driver" : HAL_RAMECC_GetHammingErrorCode(&hsramecc2)
"RAMECC Driver" --> "User Application" : HAL_OK

...

"User Application" -> "RAMECC Driver" : HAL_RAMECC_StopMonitor(&hsramecc1)
"RAMECC Driver" --> "User Application" : HAL_OK
"User Application" -> "RAMECC Driver" : HAL_RAMECC_DisableNotification(&hsramecc1)
"RAMECC Driver" --> "User Application" : HAL_OK

...

"User Application" -> "RAMECC Driver" : HAL_RAMECC_StopMonitor(&hsramecc2)
"RAMECC Driver" --> "User Application" : HAL_OK
"User Application" -> "RAMECC Driver" : HAL_RAMECC_DisableNotification(&hsramecc2)
"RAMECC Driver" --> "User Application" : HAL_OK

...

end

@enduml

@startuml

== Prerequisite: Initialization and configuration ==

group Process
"User Application" -> "RAMECC Driver" : HAL_RAMECC_EnableController_IT()
"RAMECC Driver" --> "User Application" : HAL_OK
"HW" --> "NVIC" : Interrupt
"NVIC" --> "RAMECC Driver" : HAL_RAMECC_IRQHandler()
"RAMECC Driver" --> "User Application" : User callback
"User Application" -> "RAMECC Driver" : HAL_RAMECC_GetInfo()
"RAMECC Driver" --> "User Application" : HAL_OK
"User Application" -> "RAMECC Driver" : HAL_RAMECC_DisableController()
"RAMECC Driver" --> "User Application" : HAL_OK
end

@enduml

Code snippet

HAL1

HAL2

RAMECC_HandleTypeDef hsramecc1;
RAMECC_HandleTypeDef hsramecc2;

HAL_RAMECC_StartMonitor(&hsramecc1);
HAL_RAMECC_EnableNotification(&hsramecc1);
HAL_RAMECC_StartMonitor(&hsramecc2);
HAL_RAMECC_EnableNotification(&hsramecc2);

HAL_RAMECC_IRQHandler(&hsramecc1);
HAL_RAMECC_IRQHandler(&hsramecc2);

HAL_RAMECC_GetHammingErrorCode(&hsramecc1);
HAL_RAMECC_GetHammingErrorCode(&hsramecc2);

HAL_RAMECC_StopMonitor(&hsramecc1);
HAL_RAMECC_DisableNotification(&hsramecc1);
HAL_RAMECC_StopMonitor(&hsramecc2);
HAL_RAMECC_DisableNotification(&hsramecc2);

void RAMECC_Callback1(void)
{
    /* User callback */
}
void RAMECC_Callback2(void)
{
    /* User callback */
}
hal_ramecc_controller_t hsramecc;


HAL_RAMECC_EnableController_IT(HAL_RAMECC1, interrupt);




HAL_RAMECC_IRQHandler(HAL_RAMECC_AXISRAM1);


HAL_RAMECC_GetInfo(HAL_RAMECC_AXISRAM1, &ramecc_info);


HAL_RAMECC_DisableController(HAL_RAMECC1);




void RAMECC_Callback1(void)
{
    /* User callback */
}
void RAMECC_Callback2(void)
{
    /* User callback */
}